//
//  WJDrawerController.m
//  JerryIos
//
//  Created by 王军 on 2018/2/15.
//  Copyright © 2018年 王军. All rights reserved.
//

#import "WJDrawerController.h"
#import "WJCenterController.h"
#import "WJLeftController.h"
#import "WJRightController.h"
#import "UIViewController+MMDrawerController.h"
#import "WJNavigationController.h"


@interface WJDrawerController ()

@property(nonatomic,strong) MMDrawerController * drawerController;

@end

@implementation WJDrawerController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

-(IBAction)openDrawerController {
    //1、初始化控制器
    UIViewController *leftController = [[WJLeftController alloc] init];
    UIViewController *centerController = [[WJCenterController alloc] init];
    UIViewController *rightController = [[WJRightController alloc] init];

    //2、初始化导航控制器
    WJNavigationController *centerNavController = [[WJNavigationController alloc]initWithRootViewController:centerController];
    WJNavigationController *leftNavController = [[WJNavigationController alloc]initWithRootViewController:leftController];
    WJNavigationController *rightNavController = [[WJNavigationController alloc]initWithRootViewController:rightController];

    //3、使用MMDrawerController
    self.drawerController = [[MMDrawerController alloc] initWithCenterViewController:centerNavController
                                                            leftDrawerViewController:leftNavController rightDrawerViewController:rightNavController];

    //4、设置打开/关闭抽屉的手势
    self.drawerController.openDrawerGestureModeMask = MMOpenDrawerGestureModeAll;
    self.drawerController.closeDrawerGestureModeMask = MMCloseDrawerGestureModeAll;

    //5、设置左右两边抽屉显示的多少
    self.drawerController.maximumLeftDrawerWidth = 200.0;
    self.drawerController.maximumRightDrawerWidth = 200.0;

    [self presentViewController:self.drawerController animated:YES completion:^{
        NSLog(@"presentViewController");
    }];
}

@end
